package com.block.merge.sdk;

import android.app.Activity;
import android.content.Context;

import com.block.merge.sdk.bridge.BlockCocosBridge;


public class BlockBusiness {

    public static Context context;
    public static final String GAME_MAIN_CLS = "org.cocos2dx.javascript.AppActivity";

    public static void init(Context ctx) {
        try {
            context = ctx.getApplicationContext();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void onGameActivityResume(Activity activity){
        try{
            if (activity.getClass().getName().equals(GAME_MAIN_CLS)) {
                BlockCocosBridge.getInstance().onMainGameActivityResume();
//                Log.e("BloMerge", "onGameActivityResume");
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    public static void onGameActivityPaused(Activity activity) {
        try{
            if (activity.getClass().getName().equals(GAME_MAIN_CLS)) {
                BlockCocosBridge.getInstance().onMainGameActivityPause();
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    public static void onActivityDestroyed(Activity activity) {
        try{
            if (activity.getClass().getName().equals(GAME_MAIN_CLS)) {

            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
